$(function() {   
  $(".submitapp").click(function() {   
    // validate and process form here   
	var appstatus = $("input#appstatus").val();  
	if (appstatus == "1") {   
		var appdecision = $("input#appdecision").val();  
		if(appdecision=="3"){
			var scheduledpayday = $("input#scheduledpayday").val();  
			if (scheduledpayday == "") {   
	    			alert("Please endter the scheduled pay day");
				return false;   
			}
			var setuppadday = $("input#setuppadday").val();  
			if (setuppadday == "") {   
		    		alert("Please enter the setup PAD day");
				return false;   
			}
			var approvedcredits = $("select#approvedcredits").val();  
			if (approvedcredits == "0") {   
	    			alert("Please select the credit you would like to approve for this applicant");
				return false;   
			}
		}

	} else if (appstatus == "3") {   
		var A_payment = $("input#A_payment").val();  
		if(A_payment=="4"){
			var newpayamount = $("input#newpayamount").val();  
			if (newpayamount == "") {   
	    			alert("Please enter new pay amount");
				return false;   
			}
			var partialpay = $("input#partialpay").val();  
			if (partialpay == "") {   
		    		alert("Please enter the paid amount, if no, enter 0");
				return false;   
			}
			var newpadday = $("input#newpadday").val();  
			if (newpadday == "") {   
	    			alert("Please enter the new PAD day for the collection");
				return false;   
			}
		} else if(A_payment=="8"){
			var defaultreason = $("select#defaultreason").val();  
			if (defaultreason == "") {   
	    			alert("Please select the default reason");
				return false;   
			}
		} else if(A_payment=="9"){
			var newpayamount = $("input#newpayamount").val();  
			if (newpayamount == "") {   
	    			alert("Please endter new pay amount");
				return false;   
			}
			var partialpay = $("input#partialpay").val();  
			if (partialpay == "") {   
		    		alert("Please enter the paid amount, if no, enter 0");
				return false;   
			}			
		}			

	} 
	
  });  

});   




